
TARGET = uart.bin

$(TARGET): start.o main.o clock.o led.o uart.o
	arm-linux-ld -T uart.lds -o uart.elf $^
#	arm-linux-ld -Ttext 0x0C000000 -o uart.elf $^
	arm-linux-objcopy -O binary uart.elf $@
	arm-linux-objdump -D uart.elf > uart.dis
	
%.o : %.c
	arm-linux-gcc -c $< -o $@ -fno-builtin
%.o : %.S
	arm-linux-gcc -c $< -o $@
	
.PHONY: install
install:
	-umount /dev/mmcblk0p1
	sudo dd if=/dev/zero of=/dev/mmcblk0 seek=8059870208 bs=1 count=8k
	sudo dd if=./$(TARGET) of=/dev/mmcblk0 seek=8059870208 bs=1

.PHONY:clean
clean:
	-rm *.o *.elf *.bin *.dis
